var User = require('../lib/mongo').User;

module.exports = {
    // 注册一个用户
    create: function create(user) {
        return User.create(user).exec();
    },
    update: function update(name,data){
        return Mail.update({name: name},{$set: data}).exec();
    },
    getName: function getName(name) {
        return User
            .findOne({ name: name })
            .exec();
    },
    getEmail: function getEmail(email) {
        return User.findOne({email: email}).exec();
    },
    getPhoto: function getPhoto(photo){
        return User.findOne({photo: photo}).exec();
    }
};